package com.zstk.example.mvc.zcommon.targetdata;

import com.zstk.example.mvc.zcommon.targetdata.zdomain.Test;
import com.zstk.frame.MvcResult;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 * mongo测试控制器
 * </p>
 *
 * @author zxt
 * @since 2022/7/29 11:53
 */
@Api(tags = "mongo接口测试")
@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
    @Resource
    TestService testService;

    @ApiOperation(value = "新增目标数据管理表")
    @PostMapping("/save")
    public MvcResult save(@Valid @RequestBody Test test) {
        return MvcResult.result(testService.save(test));
    }

//    @ApiOperation(value = "更新目标数据管理表")
    //    @PostMapping("/update")
    //    public MvcResult update(@Valid @RequestBody Test test) {
    //        return MvcResult.result(testService.update(new QueryWrapper<TargetData>().eq(TargetData.DbKey.id,
    //                                                                                     targetData.getId())));
    //    }
    //
    //
    //    @ApiOperation(value = "删除目标数据管理表")
    //    @PostMapping("/delete")
    //    public MvcResult delete(@Valid @RequestBody IdDTO idDTO) {
    //        return MvcResult.result(testService.removeByIds(deleteDto.getIds()));
    //    }
    //
    //    @ApiOperation(value = "获得目标数据管理表详情")
    //    @PostMapping("/get")
    //    public MvcResult getById(@Valid @RequestBody IdDTO idDTO) {
    //        return MvcResult.success().data(testService.getById(idDTO.getId()));
    //    }
    //
    //    @ApiOperation(value = "获得目标数据管理表列表")
    //    @PostMapping("/list")
    //    public MvcResult list(@RequestBody PageDTO pageDTO) {
    //        Page<Test> page = new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize());
    //        return MvcResult.success().data(testService.page(new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize()
    //        )));
    //    }
}
